library(ggplot2)
library(ggpubr)
library(CDM)
library(boot)
library(tidyverse)
library(dummy)
library(stringi)
library(stringr)

rm(list = ls())

Q_from_book <- read_csv("../data//FirstYearProject/final_result_similar.csv")
Parsed with column specification:
cols(
  Question = col_character(),
  Option1 = col_character(),
  Option2 = col_character(),
  Option3 = col_character(),
  Option4 = col_character(),
  Answer = col_character(),
  `Learning Objective` = col_character(),
  Topic = col_character(),
  `Difficulty Level` = col_character(),
  `Skill Level` = col_character(),
  `APA Learning Objective` = col_character()
)
glimpse(Q_from_book)
Observations: 1,006
Variables: 11
$ Question                 <chr> "Which of the following is an example of social influence?", "Which of the following is an example of a direct persuasion attempt?", "Not al...
$ Option1                  <chr> "a. You feel guilty because you lied to your trusting professor about your assignment.", "a. A bully threatens Billy and steals his lunch mo...
$ Option2                  <chr> "b. When you get hungry, you have trouble concentrating.", "b. Ramona works hard in school to make her mother proud.", "b. A senatorial cand...
$ Option3                  <chr> "c. You didn\u0092t do well on the test because you stayed up all night cramming.", "c. Marianne thinks of her ex-boyfriend and becomes sad....
$ Option4                  <chr> "d. You almost fall asleep at the wheel, so you pull off the road to take a short nap.", "d. Jason moves from New York to Atlanta and picks ...
$ Answer                   <chr> "A", "A", "D", "C", "A", "C", "C", "B", "D", "D", "C", "B", "C", "A", "B", "C", "D", "D", "D", "C", "A", "B", "D", "B", "D", "B", "D", "B", ...
$ `Learning Objective`     <chr> "1.1 Define social psychology and distinguish it from other disciplines.", "1.1 Define social psychology and distinguish it from other disci...
$ Topic                    <chr> "Defining Social Psychology", "Defining Social Psychology", "Defining Social Psychology", "Defining Social Psychology", "Defining Social Psy...
$ `Difficulty Level`       <chr> "Moderate", "Moderate", "Moderate", "Moderate", "Easy", "Moderate", "Moderate", "Moderate", "Moderate", "Easy", "Difficult", "Difficult", "E...
$ `Skill Level`            <chr> "Understand the Concepts", "Understand the Concepts", "Understand the Concepts", "Understand the Concepts", "Remember the Facts", "Understan...
$ `APA Learning Objective` <chr> "1.1 Describe key concepts, principles, and overarching themes in psychology.", "1.1 Describe key concepts, principles, and overarching them...

Q_from_book
NA

learning_obj <- Q_from_book %>% distinct(`Skill Level`, `Difficulty Level` ) %>% mutate(lo_id = row_number())
learning_obj
NA


Q_pre <- Q_from_book %>% inner_join(learning_obj) %>% select(Question, `Skill Level`, `Difficulty Level`, lo_id) %>% mutate(temp = str_trim(str_replace_all(Question, "_|\\.", "")))
Joining, by = c("Difficulty Level", "Skill Level")
Q_pre
NA

Q.distinct.id <- read_csv("../data/FirstYearProject/Q_distinct_id.csv") 
Parsed with column specification:
cols(
  value = col_character(),
  temp = col_character(),
  Question = col_character(),
  `Learning Objective` = col_character(),
  lo_id = col_double(),
  Q_UNIQUE_ID = col_double()
)
Q.distinct.id <- Q.distinct.id %>% mutate(temp = str_trim(str_replace_all(value, "_|\\.", "")))
Q.distinct.id

Work on this line


Q_pre %>% inner_join(Q.distinct.id, by = "temp") 
NA
```r

Q_pre %>% anti_join(Q.distinct.id) %>% distinct(Question, temp) %>% select(-temp ) %>% write_csv(\missing.csv\)

<!-- rnb-source-end -->

<!-- rnb-output-begin eyJkYXRhIjoiSm9pbmluZywgYnkgPSBcXHRlbXBcXFxuIn0= -->

Joining, by =
```

LS0tDQp0aXRsZTogIlIgTm90ZWJvb2siDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQoNCg0KYGBge3J9DQoNCmxpYnJhcnkoZ2dwbG90MikNCmxpYnJhcnkoZ2dwdWJyKQ0KbGlicmFyeShDRE0pDQpsaWJyYXJ5KGJvb3QpDQpsaWJyYXJ5KHRpZHl2ZXJzZSkNCmxpYnJhcnkoZHVtbXkpDQpsaWJyYXJ5KHN0cmluZ2kpDQpsaWJyYXJ5KHN0cmluZ3IpDQoNCg0KYGBgDQoNCg0KYGBge3J9DQoNCnJtKGxpc3QgPSBscygpKQ0KDQpRX2Zyb21fYm9vayA8LSByZWFkX2NzdigiLi4vZGF0YS8vRmlyc3RZZWFyUHJvamVjdC9maW5hbF9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